package com.itheima.array;

public class ArrayTest2 {
    public static void main(String[] args) {
        int[] arr1={33,66,77,34,67};
        int[] arr2={44,100,43,78,12};
        int max=getMax(arr2);
        System.out.println("最大值为"+max);
    }
    /*
    求数组中最大值
     */
    public static int getMax(int[] arr) {
        int max=arr[0];
        for (int i=0;i<arr.length;i++){
            if(arr[i]>max){
                max=arr[i];
            }
        }
        return max;

    }
}
